import 'dart:ui';
import 'package:factoryside/api/api.dart';
import 'package:factoryside/bean/add_order_entity.dart';
import 'package:factoryside/bean/factory_address_entity.dart';
import 'package:factoryside/bean/factory_brand_entity.dart';
import 'package:factoryside/bean/factory_prod_entity.dart';
import 'package:factoryside/bean/part_entity.dart';
import 'package:factoryside/bean/prod_category_entity.dart';
import 'package:factoryside/bean/prod_model_entity.dart';
import 'package:factoryside/bean/prod_specifications_entity.dart';
import 'package:factoryside/generated/json/factory_address_entity_helper.dart';
import 'package:factoryside/generated/json/factory_brand_entity_helper.dart';
import 'package:factoryside/generated/json/factory_prod_entity_helper.dart';
import 'package:factoryside/generated/json/part_entity_helper.dart';
import 'package:factoryside/generated/json/prod_category_entity_helper.dart';
import 'package:factoryside/generated/json/prod_model_entity_helper.dart';
import 'package:factoryside/generated/json/prod_specifications_entity_helper.dart';
import 'package:factoryside/home/page_confirm.dart';
import 'package:factoryside/utils/ColorsUtils.dart';
import 'package:factoryside/utils/request_util.dart';
import 'package:factoryside/utils/utils.dart';
import 'package:factoryside/widget/jh_login_textfield.dart';
import 'package:factoryside/widget/my_number_textInputFormatter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_my_picker/common/date.dart';
import 'package:flutter_my_picker/flutter_my_picker.dart';


///下一步

class NextPage extends StatefulWidget {
  AddOrderEntity _addOrderEntity;
  String addr;
  String memo='';

  NextPage(this._addOrderEntity,this.addr,this.memo);

  @override
  State<StatefulWidget> createState() {
    return _NextState();
  }
}

class _NextState extends State<NextPage> with AutomaticKeepAliveClientMixin {
  var searchCon = TextEditingController();
  var searchOfCategoryCon = TextEditingController();
  var searchOfSpecificationsCon = TextEditingController();
  var searchOfBrandCon = TextEditingController();
  var searchOfModelCon = TextEditingController();
  var searchOfPartCon = TextEditingController();
  var categoryCon = TextEditingController();
  var specificationCon = TextEditingController();
  var brandCon = TextEditingController();
  var modelCon = TextEditingController();

  var numCon = TextEditingController();

  var timeCon = TextEditingController();
  var barcodeCon = TextEditingController();
  var prodExpressNoCon = TextEditingController();
  var expressNoCon = TextEditingController();
  var memoCon = TextEditingController();

  bool _hasSelected = false;
  bool _noSelected = false;
  bool _trueSelected = false;
  bool _falseSelected = false;
  bool _wokerSelected = false;
  bool _factorySelected = false;

  List<FactoryProdEntityIsSelected> prodList = []; //常用型号
  FactoryProdEntityIsSelected fpSelected;

  int subCategoryID;

  int specificationsID;

  int modelID;

  int brandID;

  int num=1;

  String partStr;
  String addrStr;

  int addrID;

  List<AddOrderProdsPartsVal> partsVal;

  @override
  void initState() {
    super.initState();
    memoCon.text=widget.memo;
    searchCommonProd('');
  }

  void searchCommonProd(String keyword) {
    RequestUtil.post(Api.getFactoryProd, {'sreachName': keyword}).then((value) {
      List tempList = value['Data'];
      prodList.clear();
      tempList.forEach((element) {
        prodList.add(FactoryProdEntityIsSelected(
            factoryProdEntityFromJson(FactoryProdEntity(), element)));
      });
      setState(() {});
    });
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  // TODO: implement wantKeepAlive
  bool get wantKeepAlive => true;

  @override
  Widget build(BuildContext context) {
    super.build(context); //必须实现 不然 在push过后页面会刷新
    // TODO: implement build
    var signs = [
      '保内安装',
      '待预约',
      '配件待审核',
      '配件审核通过',
      '催单',
      '费用待审核',
      '费用审核不通过',
      '超时未预约',
      '今日需上门',
      '超时未上门',
      '新留言'
    ];
    var colors = [
      '#2196F3',
      '#FD8387',
      '#5AFF15',
      '#FFFE1D',
      '#2DFFE9',
      '#C100FD',
      '#B4D1FB',
      '#FF67C5',
      '#E2FFBA',
      '#88FFD6',
      '#FDFF39',
    ];
    return Scaffold(
      appBar: AppBar(
        title: Text('发布工单'),
      ),
      body: Container(
        color: ColorsUtil.hexToColor('#EFEFEF'),
        child: Column(children: [
          Expanded(
            child: ListView(
              children: [
                Container(
                  color: Colors.white,
                  margin: EdgeInsets.symmetric(vertical: 10),
                  child: Column(
                    children: [
                      Container(
                        margin: EdgeInsets.all(10),
                        decoration: BoxDecoration(
                            color: Color.fromARGB(180, 240, 240, 240),
                            borderRadius: BorderRadius.all(Radius.circular(3))),
                        child: Row(
                          children: [
                            Expanded(
                                child: Container(
                                    padding:
                                        EdgeInsets.symmetric(horizontal: 10),
                                    child: TextField(
                                      controller: searchCon,
                                      onSubmitted: (keyword){
                                        searchCommonProd(keyword);
                                      },
                                      style: TextStyle(
                                          fontSize: 16, color: Colors.black),
                                      maxLines: 1,
//                                    keyboardType: TextInputType.text,
                                      decoration: InputDecoration(
                                        hintText: '搜索常用型号',
                                        counterText: '',
                                        disabledBorder: InputBorder.none,
                                        enabledBorder: InputBorder.none,
                                        focusedBorder: InputBorder.none,
                                      ),
                                    ))),
                            ElevatedButton(onPressed: () {
                              if (searchCon.text.isNotEmpty) {
                                searchCommonProd(searchCon.text);
                              } else {
                                showToast('内容不能为空');
                              }
                            }, child: Text('搜索')),
                          ],
                        ),
                      ),
                      Container(
                        padding: EdgeInsets.all(10),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Text('常用：'),
                            Expanded(
                              child: prodList.length>0?Wrap(
                                spacing: 5,
                                runSpacing: 5,
                                children: prodList
                                    .map((element) => InkWell(
                                  child: Container(
                                    padding: EdgeInsets.symmetric(
                                        vertical: 8, horizontal: 10),
                                    decoration: BoxDecoration(
                                        color: ColorsUtil.hexToColor(
                                            element.isSelected?'#FD8387':'#ffffff'),
                                        border: Border.all(
                                            width: 0.2,
                                            color: Colors.grey),
                                        borderRadius: BorderRadius.all(
                                            Radius.circular(2))),
                                    child: Text(
                                      '${element.prod.brandName}-${element.prod.prodModel}',
                                      style: TextStyle(
                                          fontSize: 16,
                                          color: element.isSelected?Colors.white:Colors.black),
                                      textAlign: TextAlign.center,
                                    ),
                                  ),
                                  onTap: (){
                                    fpSelected=element;

                                    subCategoryID=fpSelected.prod.subCategoryID;
                                    specificationsID=fpSelected.prod.productTypeID;
                                    brandID=fpSelected.prod.brandID;
                                    modelID=fpSelected.prod.prodModelID;

                                    categoryCon.text=fpSelected.prod.subCategoryName;
                                    specificationCon.text=fpSelected.prod.productTypeName;
                                    brandCon.text=fpSelected.prod.brandName;
                                    modelCon.text=fpSelected.prod.prodModel;

                                    prodList.forEach((temp) {
                                      if(element.prod.id==temp.prod.id){
                                        temp.isSelected=true;
                                      }else{
                                        temp.isSelected=false;
                                      }
                                    });
                                    setState(() {

                                    });
                                  },
                                ))
                                    .toList(),
                              ):Text('没有任何产品',style: TextStyle(color: Colors.grey),),
                            ),
                          ],
                        ),
                      ),
                    ],
                  ),
                ),
                Container(
                  child: Column(
                    children: [
                      GestureDetector(
                        child: Container(
                          color: Colors.white,
                          padding: EdgeInsets.all(10),
                          child: Row(
                            children: [
                              Text('*产品类别：'),
                              SizedBox(
                                width: 10,
                              ),
                              Expanded(
                                  child: JhLoginTextField(
                                controller: categoryCon,
//                                  text: districtName != null
//                                      ? '$provinceName$cityName$areaName$districtName'
//                                      : '',
                                hintText: '请选择产品类别',
                                border: InputBorder.none,
                                isShowDeleteBtn: false,
                                isDense: true,
                                enable: false,
                              )),
                              Icon(
                                Icons.chevron_right,
                                color: Colors.grey,
                              )
                            ],
                          ),
                        ),
                        onTap: () {
                          showPopOfCate();
                        },
                      ),
                      Divider(
                        height: 1,
                      ),
                      GestureDetector(
                        child: Container(
                          color: Colors.white,
                          padding: EdgeInsets.all(10),
                          child: Row(
                            children: [
                              Text('*产品规格：'),
                              SizedBox(
                                width: 10,
                              ),
                              Expanded(
                                  child: JhLoginTextField(
                                controller: specificationCon,
//                                  text: districtName != null
//                                      ? '$provinceName$cityName$areaName$districtName'
//                                      : '',
                                hintText: '请选择产品规格',
                                border: InputBorder.none,
                                isShowDeleteBtn: false,
                                isDense: true,
                                enable: false,
                              )),
                              Icon(
                                Icons.chevron_right,
                                color: Colors.grey,
                              )
                            ],
                          ),
                        ),
                        onTap: () {
                          showPopOfSpecification();
                        },
                      ),
                      Divider(
                        height: 1,
                      ),
                      GestureDetector(
                        child: Container(
                          color: Colors.white,
                          padding: EdgeInsets.all(10),
                          child: Row(
                            children: [
                              Text('*产品品牌：'),
                              SizedBox(
                                width: 10,
                              ),
                              Expanded(
                                  child: JhLoginTextField(
                                controller: brandCon,
//                                  text: districtName != null
//                                      ? '$provinceName$cityName$areaName$districtName'
//                                      : '',
                                hintText: '请选择产品品牌',
                                border: InputBorder.none,
                                isShowDeleteBtn: false,
                                isDense: true,
                                enable: false,
                              )),
                              Icon(
                                Icons.chevron_right,
                                color: Colors.grey,
                              )
                            ],
                          ),
                        ),
                        onTap: () {
                          showPopOfBrand();
                        },
                      ),
                      Divider(
                        height: 1,
                      ),
                      GestureDetector(
                        child: Container(
                          color: Colors.white,
                          padding: EdgeInsets.all(10),
                          child: Row(
                            children: [
                              Text('*产品型号：'),
                              SizedBox(
                                width: 10,
                              ),
                              Expanded(
                                  child: JhLoginTextField(
                                controller: modelCon,
//                                  text: districtName != null
//                                      ? '$provinceName$cityName$areaName$districtName'
//                                      : '',
                                hintText: '请选择产品型号',
                                border: InputBorder.none,
                                isShowDeleteBtn: false,
                                isDense: true,
                                enable: false,
                              )),
                              Icon(
                                Icons.chevron_right,
                                color: Colors.grey,
                              )
                            ],
                          ),
                        ),
                        onTap: () {
                          showPopOfModel();
                        },
                      ),
                      Divider(
                        height: 1,
                      ),
                      Container(
                        color: Colors.white,
                        padding: EdgeInsets.all(10),
                        child: Row(
                          children: [
                            Text('*产品数量：'),
                            SizedBox(
                              width: 10,
                            ),
                            Expanded(
                              child: Row(
                                children: [
                                  GestureDetector(
                                      onTap: () {
                                        hideKeyboard(context);
                                        setState(() {
                                          if (num>1) {
                                            num--;
                                            numCon.text='$num';
                                          }
                                        });
                                      },
                                      child: Icon(Icons.remove_circle_outline,color: ColorsUtil.hexToColor(Api.btnColor),size: 25,)),
                                  Container(
                                    width: 100,
                                    child: JhLoginTextField(
                                      controller: numCon,
                                      text: '$num',
                                      textAlign: TextAlign.center,
                                      inputFormatters: [MyNumberTextInputFormatter()],
                                      hintText: '请输入数量',
                                      inputCallBack: (value){
                                        var count=int.tryParse(value);
                                        if(count==null){
                                          num=1;
                                          hideKeyboard(context);
                                        }else{
                                          num=count;
                                        }
                                        numCon.text='$num';
                                        numCon.selection=TextSelection.fromPosition(
                                            TextPosition(
                                                offset:
                                                numCon.text.length));
                                      },
                                      border: InputBorder.none,
                                      isShowDeleteBtn: false,
                                      isDense: true,
                                    ),
                                  ),
                                  GestureDetector(
                                      onTap: () {
                                        hideKeyboard(context);
                                        setState(() {
                                          num++;
                                          numCon.text='$num';
                                        });
                                      },
                                      child: Icon(Icons.add_circle_outline,color: ColorsUtil.hexToColor(Api.btnColor),size: 25,))
                                ],
                              ),
                            )
                          ],
                        ),
                      ),
                      Divider(
                        height: 1,
                      ),
                      GestureDetector(
                        child: Container(
                          color: Colors.white,
                          padding: EdgeInsets.all(10),
                          child: Row(
                            children: [
                              Text('购买时间：'),
                              SizedBox(
                                width: 10,
                              ),
                              Expanded(
                                  child: JhLoginTextField(
                                controller: timeCon,
//                                  text: districtName != null
//                                      ? '$provinceName$cityName$areaName$districtName'
//                                      : '',
                                hintText: '请选择时间',
                                border: InputBorder.none,
                                isShowDeleteBtn: false,
                                isDense: true,
                                enable: false,
                              )),
                              Icon(
                                Icons.chevron_right,
                                color: Colors.grey,
                              )
                            ],
                          ),
                        ),
                        onTap: () {
                          MyPicker.showPicker(
                            context: context,
                            current: DateTime.now(),
                            end: DateTime.now(),
                            mode: MyPickerMode.date,
                            onConfirm: (_date) {
                              print('confirm$_date');
                              timeCon.text=MyDate.format('yyyy-MM-dd', _date);
                              setState(() {

                              });
                            },
                          );
                        },
                      ),
                      Divider(
                        height: 1,
                      ),
                      Container(
                        color: Colors.white,
                        padding: EdgeInsets.all(10),
                        child: Row(
                          children: [
                            Text('条 形 码：'),
                            SizedBox(
                              width: 10,
                            ),
                            Expanded(
                              child: JhLoginTextField(
                                controller: barcodeCon,
                                hintText: '请输入条形码',
                                border: InputBorder.none,
                                isShowDeleteBtn: true,
                                isDense: true,
                              ),
                            )
                          ],
                        ),
                      ),
                      Visibility(
                        visible: widget._addOrderEntity.servicetype==2&&widget._addOrderEntity.guaranteetype==1,
                        child: Column(
                          children: [
                            Divider(
                              height: 1,
                            ),
                            Container(
                              color: Colors.white,
                              padding: EdgeInsets.all(10),
                              child: Row(
                                children: [
                                  Text('快递单号：'),
                                  SizedBox(
                                    width: 10,
                                  ),
                                  Expanded(
                                    child: JhLoginTextField(
                                      controller: prodExpressNoCon,
                                      hintText: '请输入快递单号',
                                      border: InputBorder.none,
                                      isShowDeleteBtn: true,
                                      isDense: true,
                                    ),
                                  )
                                ],
                              ),
                            ),
                          ],
                        ),
                      ),
                      Visibility(
                        visible: widget._addOrderEntity.servicetype==1&&widget._addOrderEntity.guaranteetype==1,
                        child: Column(
                        children: [
                          Divider(
                            height: 1,
                          ),
                          Container(
                            color: Colors.white,
                            padding: EdgeInsets.all(10),
                            child: Row(
                              children: [
                                Text('*已发配件：'),
                                SizedBox(
                                  width: 10,
                                ),
                                Expanded(
                                  child: Row(
                                    mainAxisAlignment: MainAxisAlignment.start,
                                    children: [
                                      // 复选框
                                      GestureDetector(
                                        behavior: HitTestBehavior.opaque,
                                        child: Row(
                                          children: [
                                            Container(
                                              padding: EdgeInsets.symmetric(vertical: 10,horizontal: 15),
                                              child: Image.asset(
                                                _hasSelected
                                                    ? 'assets/checked.png'
                                                    : 'assets/unchecked.png',
                                                width: 15,
                                                height: 15,
                                              ),
                                            ),
                                            Text('未发',
                                                textAlign: TextAlign.end,
                                                style: TextStyle(

                                                    color: Colors.black)),
                                          ],
                                        ),
                                        onTap: () {
                                          setState(() {
                                            _hasSelected = true;
                                            _noSelected = false;
                                          });
                                        },
                                      ),
                                      GestureDetector(
                                        behavior: HitTestBehavior.opaque,
                                        child: Row(
                                          children: [
                                            Container(
                                              padding: EdgeInsets.symmetric(vertical: 10,horizontal: 15),
                                              child: Image.asset(
                                                _noSelected
                                                    ? 'assets/checked.png'
                                                    : 'assets/unchecked.png',
                                                width: 15,
                                                height: 15,
                                              ),
                                            ),
                                            Text('已发',
                                                textAlign: TextAlign.end,
                                                style: TextStyle(

                                                    color: Colors.black)),
                                          ],
                                        ),
                                        onTap: () {
                                          setState(() {
                                            _hasSelected = false;
                                            _noSelected = true;
                                          });
                                        },
                                      ),
                                    ],
                                  ),
                                )
                              ],
                            ),
                          ),
                          Visibility(
                            visible: _noSelected,
                            child: Column(
                              children: [
                                Divider(
                                  height: 1,
                                ),
                                GestureDetector(
                                  child: Container(
                                    color: Colors.white,
                                    padding: EdgeInsets.all(10),
                                    child: Row(
                                      children: [
                                        Text('*选择配件：'),
                                        SizedBox(
                                          width: 10,
                                        ),
                                        Expanded(
                                            child: Container(
                                              padding: EdgeInsets.symmetric(vertical: 5),
                                              child: Text(
                                                partStr==null?'请选择配件':partStr,
                                                style: TextStyle(color: partStr==null?Colors.grey:Colors.black),
                                              ),
                                            )),
                                        Icon(
                                          Icons.chevron_right,
                                          color: Colors.grey,
                                        )
                                      ],
                                    ),
                                  ),
                                  onTap: () {
                                    showPopOfPart();
                                  },
                                ),
                                Divider(
                                  height: 1,
                                ),
                                Container(
                                  color: Colors.white,
                                  padding: EdgeInsets.all(10),
                                  child: Row(
                                    children: [
                                      Text('*配件快递单号：'),
                                      SizedBox(
                                        width: 10,
                                      ),
                                      Expanded(
                                        child: JhLoginTextField(
                                          controller: expressNoCon,
                                          hintText: '请输入配件快递单号',
                                          border: InputBorder.none,
                                          isShowDeleteBtn: true,
                                          isDense: true,
                                        ),
                                      )
                                    ],
                                  ),
                                ),
                                Divider(
                                  height: 1,
                                ),
                                Container(
                                  color: Colors.white,
                                  padding: EdgeInsets.all(10),
                                  child: Row(
                                    children: [
                                      Text('*是否返件：'),
                                      SizedBox(
                                        width: 10,
                                      ),
                                      Expanded(
                                        child: Row(
                                          mainAxisAlignment: MainAxisAlignment.start,
                                          children: [
                                            // 复选框
                                            GestureDetector(
                                              behavior: HitTestBehavior.opaque,
                                              child: Row(
                                                children: [
                                                  Container(
                                                    padding: EdgeInsets.symmetric(vertical: 10,horizontal: 15),
                                                    child: Image.asset(
                                                      _trueSelected
                                                          ? 'assets/checked.png'
                                                          : 'assets/unchecked.png',
                                                      width: 15,
                                                      height: 15,
                                                    ),
                                                  ),
                                                  Text('是',
                                                      textAlign: TextAlign.end,
                                                      style: TextStyle(

                                                          color: Colors.black)),
                                                ],
                                              ),
                                              onTap: () {
                                                setState(() {
                                                  _trueSelected = true;
                                                  _falseSelected = false;
                                                });
                                              },
                                            ),
                                            GestureDetector(
                                              behavior: HitTestBehavior.opaque,
                                              child: Row(
                                                children: [
                                                  Container(
                                                    padding: EdgeInsets.symmetric(vertical: 10,horizontal: 15),
                                                    child: Image.asset(
                                                      _falseSelected
                                                          ? 'assets/checked.png'
                                                          : 'assets/unchecked.png',
                                                      width: 15,
                                                      height: 15,
                                                    ),
                                                  ),
                                                  Text('否',
                                                      textAlign: TextAlign.end,
                                                      style: TextStyle(

                                                          color: Colors.black)),
                                                ],
                                              ),
                                              onTap: () {
                                                setState(() {
                                                  _trueSelected = false;
                                                  _falseSelected = true;
                                                });
                                              },
                                            ),
                                          ],
                                        ),
                                      )
                                    ],
                                  ),
                                ),
                                Visibility(
                                  visible: _trueSelected,
                                    child: Column(children: [
                                  Divider(
                                    height: 1,
                                  ),
                                  Container(
                                    color: Colors.white,
                                    padding: EdgeInsets.all(10),
                                    child: Row(
                                      children: [
                                        Text('*邮费支付方式：'),
                                        SizedBox(
                                          width: 10,
                                        ),
                                        Expanded(
                                          child: Row(
                                            mainAxisAlignment: MainAxisAlignment.start,
                                            children: [
                                              // 复选框
                                              GestureDetector(
                                                behavior: HitTestBehavior.opaque,
                                                child: Row(
                                                  children: [
                                                    Container(
                                                      padding: EdgeInsets.symmetric(vertical: 10,horizontal: 15),
                                                      child: Image.asset(
                                                        _wokerSelected
                                                            ? 'assets/checked.png'
                                                            : 'assets/unchecked.png',
                                                        width: 15,
                                                        height: 15,
                                                      ),
                                                    ),
                                                    Text('师傅现付',
                                                        textAlign: TextAlign.end,
                                                        style: TextStyle(

                                                            color: Colors.black)),
                                                  ],
                                                ),
                                                onTap: () {
                                                  setState(() {
                                                    _wokerSelected = true;
                                                    _factorySelected = false;
                                                  });
                                                },
                                              ),
                                              GestureDetector(
                                                behavior: HitTestBehavior.opaque,
                                                child: Row(
                                                  children: [
                                                    Container(
                                                      padding: EdgeInsets.symmetric(vertical: 10,horizontal: 15),
                                                      child: Image.asset(
                                                        _factorySelected
                                                            ? 'assets/checked.png'
                                                            : 'assets/unchecked.png',
                                                        width: 15,
                                                        height: 15,
                                                      ),
                                                    ),
                                                    Text('工厂到付',
                                                        textAlign: TextAlign.end,
                                                        style: TextStyle(

                                                            color: Colors.black)),
                                                  ],
                                                ),
                                                onTap: () {
                                                  setState(() {
                                                    _wokerSelected = false;
                                                    _factorySelected = true;
                                                  });
                                                },
                                              ),
                                            ],
                                          ),
                                        )
                                      ],
                                    ),
                                  ),
                                  Divider(
                                    height: 1,
                                  ),
                                  GestureDetector(
                                    child: Container(
                                      color: Colors.white,
                                      padding: EdgeInsets.all(10),
                                      child: Row(
                                        children: [
                                          Text('*选择收件地址：'),
                                          SizedBox(
                                            width: 10,
                                          ),
                                          Expanded(
                                              child: Container(
                                                padding: EdgeInsets.symmetric(vertical: 5),
                                                child: Text(
                                                  addrStr==null?'请选择收件地址':addrStr,
                                                  style: TextStyle(color: addrStr==null?Colors.grey:Colors.black),
                                                ),
                                              )),
                                          Icon(
                                            Icons.chevron_right,
                                            color: Colors.grey,
                                          )
                                        ],
                                      ),
                                    ),
                                    onTap: () {
                                      showPopOfAddr();
                                    },
                                  ),
                                ],)),
                              ],
                            ),
                          )
                        ],
                      ),),

                    ],
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(top: 10),
                  padding: EdgeInsets.all(10),
                  color: Colors.white,
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text('*服务要求：'),
                      SizedBox(
                        width: 10,
                      ),
                      Container(
                          padding:
                              EdgeInsets.only(bottom: 5, left: 10, right: 10),
                          width: double.infinity,
                          decoration: BoxDecoration(
//                              color: Color.fromARGB(180, 240, 240, 240),
//                    border: Border.all(
//                        width: 0.2, color: Colors.grey),
                              borderRadius:
                                  BorderRadius.all(Radius.circular(3))),
                          child: TextField(
                            controller: memoCon,
                            style: TextStyle(fontSize: 16, color: Colors.black),
                            maxLines: 4,
//                                    keyboardType: TextInputType.text,
                            decoration: InputDecoration(
                              hintText: '请填写服务要求',
                              counterText: '',
                              disabledBorder: InputBorder.none,
                              enabledBorder: InputBorder.none,
                              focusedBorder: InputBorder.none,
                            ),
                          )),
                    ],
                  ),
                ),
              ],
            ),
          ),
          Container(
              color: Colors.white,
              padding: EdgeInsets.fromLTRB(0, 5, 20, 5),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  ElevatedButton(
                      onPressed: () {
                        if(subCategoryID==null){
                          showToast('请选择类别');
                          return;
                        }
                        if(specificationsID==null){
                          showToast('请选择规格');
                          return;
                        }
                        if(brandID==null){
                          showToast('请选择品牌');
                          return;
                        }
                        if(modelID==null){
                          showToast('请选择型号');
                          return;
                        }
                        print('widget._addOrderEntity.servicetype:${widget._addOrderEntity.servicetype}');
                        print('widget._addOrderEntity.guaranteetype:${widget._addOrderEntity.guaranteetype}');
                        if(widget._addOrderEntity.servicetype==1&&widget._addOrderEntity.guaranteetype==1){
                          if(!_hasSelected&&!_noSelected){
                            showToast('请选择是否已发配件');
                            return;
                          }
                          if(_noSelected){//已发配件
                            if(partStr==null){
                              showToast('请选择配件');
                              return;
                            }
                            if(expressNoCon.text.isEmpty){
                              showToast('请输入配件快递单号');
                              return;
                            }
                            if(!_trueSelected&&!_falseSelected){
                              showToast('请选择是否返件');
                              return;
                            }
                            if(_trueSelected){
                              if(!_wokerSelected&&!_factorySelected){
                                showToast('请选择邮费支付方式');
                                return;
                              }
                              if(addrStr==null){
                                showToast('请选择收件地址');
                                return;
                              }
                            }
                          }
                        }
                        if(memoCon.text.isEmpty){
                          showToast('请填写服务要求');
                          return;
                        }
                        AddOrderProd prod=AddOrderProd();
                        prod.subCategoryID=subCategoryID;
                        prod.specifications=specificationsID;
                        prod.factoryBrandname=brandID;
                        prod.prodModel=modelID;
                        prod.num=num;
                        prod.buyingProductsTime=timeCon.text;
                        prod.factoryBarCode=barcodeCon.text;
                        prod.prodExpressNo=prodExpressNoCon.text;
                        if (_noSelected) {//已发配件
                          prod.partsVal=partsVal;
                          prod.expressNo=expressNoCon.text;
                        }
                        prod.bak=memoCon.text;
                        widget._addOrderEntity.prods=[];
                        widget._addOrderEntity.prods.add(prod);
                        widget._addOrderEntity.backParts=_trueSelected?1:2;//1返件 2不返件
                        if (_trueSelected) {//返件
                          widget._addOrderEntity.postpaytype=_factorySelected?1:2; //1工厂到付 2师傅现付
                          widget._addOrderEntity.backAddress=addrID;
                        }
                        push(context, ConfirmPage(
                            widget._addOrderEntity,
                            _noSelected,
                            widget.addr,
                            categoryCon.text,
                            specificationCon.text,
                            brandCon.text,
                            modelCon.text,
                            partStr,
                            addrStr
                        ));
                      },
                      child: Text('提交')),
                ],
              )),
        ]),
      ),
    );
  }
  ///选择配件
  void showPopOfPart() {
    List<PartEntityIsSelected> partList=[];
    if(subCategoryID==null){
      showToast('请先选择分类');
      return;
    }
    RequestUtil.post(Api.getParts, {'subCategoryID':subCategoryID}).then((value) {
      List tempList=value['Data'];
      tempList.forEach((element) {
        partList.add(PartEntityIsSelected(partEntityFromJson(PartEntity(), element)));
      });
      if (partList.length>0) {
        showModalBottomSheet(
            context: context,
            isScrollControlled: true,
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(10), topRight: Radius.circular(10))),
            builder: (context) {
              return StatefulBuilder(builder: (BuildContext context, StateSetter setState){
                return Column(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    Stack(
                      children: [
                        Align(
                          alignment: Alignment.topLeft,
                          child: Container(
                            margin: EdgeInsets.only(right: 10),
                            child: TextButton(
                                onPressed: () {
                                  Navigator.of(context).pop();
                                },
                                child: Text('取消')),
                          ),
                        ),
                        Align(
                          alignment: Alignment.center,
                          child: Padding(
                            padding: const EdgeInsets.symmetric(vertical: 14),
                            child: Text(
                              '选择配件',
                              style: TextStyle(fontSize: 18),
                            ),
                          ),
                        ),
                        Align(
                          alignment: Alignment.topRight,
                          child: Container(
                            margin: EdgeInsets.only(right: 10),
                            child: TextButton(
                                onPressed: () {
                                  this.setState(() {
                                    partStr='';
                                    partsVal=[];
                                    partList.forEach((element) {
                                      if(element.isSelected){
                                        partStr+=element.part.name+'、';
                                        AddOrderProdsPartsVal part=AddOrderProdsPartsVal();
                                        part.value=element.part.value;
                                        partsVal.add(part);
                                      }
                                    });
                                    if(partStr.contains('、')){
                                      partStr=partStr.substring(0,partStr.lastIndexOf('、'));
                                      Navigator.of(context).pop();
                                    }else{
                                      showToast('请选择配件');
                                    }
                                  });
                                },
                                child: Text('确定')),
                          ),
                        ),
                      ],
                    ),
//                Container(
//                  margin: EdgeInsets.all(10),
//                  decoration: BoxDecoration(
//                      color: Color.fromARGB(180, 240, 240, 240),
//                      borderRadius: BorderRadius.all(Radius.circular(3))),
//                  child: Row(
//                    children: [
//                      Expanded(
//                          child: Container(
//                              padding: EdgeInsets.symmetric(horizontal: 10),
//                              child: TextField(
//                                controller: searchOfPartCon,
//                                style:
//                                TextStyle(fontSize: 16, color: Colors.black),
//                                maxLines: 1,
////                                    keyboardType: TextInputType.text,
//                                decoration: InputDecoration(
//                                  hintText: '搜索配件',
//                                  counterText: '',
//                                  disabledBorder: InputBorder.none,
//                                  enabledBorder: InputBorder.none,
//                                  focusedBorder: InputBorder.none,
//                                ),
//                              ))),
//                      ElevatedButton(onPressed: () {}, child: Text('搜索')),
//                    ],
//                  ),
//                ),
//                Container(
//                  margin: EdgeInsets.symmetric(horizontal: 10),
//                  child: ElevatedButton(
//                      onPressed: () {
//                        showToast('待开发...');
//                      },
//                      child: Container(
//                          padding: EdgeInsets.symmetric(vertical: 15),
//                          child: Row(
//                            mainAxisAlignment: MainAxisAlignment.center,
//                            children: [
//                              Text('添加新配件'),
//                            ],
//                          ))),
//                ),
                    Container(
                      height: MediaQuery.of(context).size.height * 0.6,
                      child: ListView.separated(
                        itemCount: partList.length,
                        itemBuilder: (context, index) => ListTile(
                            title: Row(
                              children: [
                                Container(
                                  padding: EdgeInsets.symmetric(vertical: 10,horizontal: 15),
                                  child: Image.asset(
                                    partList[index].isSelected
                                        ? 'assets/checked.png'
                                        : 'assets/unchecked.png',
                                    width: 15,
                                    height: 15,
                                  ),
                                ),
                                Expanded(child: Text(partList[index].part.name)),
                              ],
                            ),
                            onTap: (){
                              setState((){
                                partList[index].isSelected=!partList[index].isSelected;
                              });
                            }
                        ),
                        separatorBuilder: (context, index) => Divider(),
                      ),
                    )
                  ],
                );
              });
            });
      } else {
        showToast('暂未配置配件，请在电脑端配置');
      }
    });

  }
  ///选择型号
  void showPopOfModel() {
    List<ProdModelEntity> prodModelList=[];
    if(specificationsID==null){
      showToast('请先选择规格');
      return;
    }
    RequestUtil.post(Api.getProdModel, {'specificationsID':specificationsID}).then((value) {
      List tempList=value['Data'];
      tempList.forEach((element) {
        prodModelList.add(prodModelEntityFromJson(ProdModelEntity(), element));
      });
      if (prodModelList.length>0) {
        showModalBottomSheet(
            context: context,
            isScrollControlled: true,
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(10), topRight: Radius.circular(10))),
            builder: (context) {
              return Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  Stack(
                    children: [
                      Align(
                        alignment: Alignment.center,
                        child: Padding(
                          padding: const EdgeInsets.symmetric(vertical: 14),
                          child: Text(
                            '产品型号',
                            style: TextStyle(fontSize: 18),
                          ),
                        ),
                      ),
                      Align(
                        alignment: Alignment.topRight,
                        child: Container(
                          margin: EdgeInsets.only(right: 10),
                          child: TextButton(
                              onPressed: () {
                                Navigator.of(context).pop();
                              },
                              child: Text('取消')),
                        ),
                      ),
                    ],
                  ),
//              Container(
//                margin: EdgeInsets.all(10),
//                decoration: BoxDecoration(
//                    color: Color.fromARGB(180, 240, 240, 240),
//                    borderRadius: BorderRadius.all(Radius.circular(3))),
//                child: Row(
//                  children: [
//                    Expanded(
//                        child: Container(
//                            padding: EdgeInsets.symmetric(horizontal: 10),
//                            child: TextField(
//                              controller: searchOfModelCon,
//                              style:
//                                  TextStyle(fontSize: 16, color: Colors.black),
//                              maxLines: 1,
////                                    keyboardType: TextInputType.text,
//                              decoration: InputDecoration(
//                                hintText: '搜索型号',
//                                counterText: '',
//                                disabledBorder: InputBorder.none,
//                                enabledBorder: InputBorder.none,
//                                focusedBorder: InputBorder.none,
//                              ),
//                            ))),
//                    ElevatedButton(onPressed: () {}, child: Text('搜索')),
//                  ],
//                ),
//              ),
//              Container(
//                margin: EdgeInsets.symmetric(horizontal: 10),
//                child: ElevatedButton(
//                    onPressed: () {
//                      showToast('待开发...');
//                    },
//                    child: Container(
//                        padding: EdgeInsets.symmetric(vertical: 15),
//                        child: Row(
//                      mainAxisAlignment: MainAxisAlignment.center,
//                      children: [
//                        Text('添加新型号'),
//                      ],
//                    ))),
//              ),
                  Container(
                    height: MediaQuery.of(context).size.height * 0.6,
                    child: ListView.separated(
                      itemCount: prodModelList.length,
                      itemBuilder: (context, index) => ListTile(
                          title: Text(prodModelList[index].modelName),
                          onTap: (){
                            setState(() {
                              modelCon.text=prodModelList[index].modelName;
                              modelID=prodModelList[index].id;
                              Navigator.pop(context);
                            });
                          }
                      ),
                      separatorBuilder: (context, index) => Divider(),
                    ),
                  )
                ],
              );
            });
      } else {
        showToast('暂未配置型号，请在电脑端配置');
      }
    });

  }

  ///选择类别
  void showPopOfCate() {
    List<ProdCategoryEntity> cateList=[];
    RequestUtil.post(Api.getProdCategory, {}).then((value) {
      List tempList=value['Data'];
      tempList.forEach((element) {
        cateList.add(prodCategoryEntityFromJson(ProdCategoryEntity(), element));
      });
      if (cateList.length>0) {
        showModalBottomSheet(
                  context: context,
                  isScrollControlled: true,
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.only(
                          topLeft: Radius.circular(10), topRight: Radius.circular(10))),
                  builder: (context) {
                    return Column(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Stack(
                          children: [
                            Align(
                              alignment: Alignment.center,
                              child: Padding(
                                padding: const EdgeInsets.symmetric(vertical: 14),
                                child: Text(
                                  '产品类别',
                                  style: TextStyle(fontSize: 18),
                                ),
                              ),
                            ),
                            Align(
                              alignment: Alignment.topRight,
                              child: Container(
                                margin: EdgeInsets.only(right: 10),
                                child: TextButton(
                                    onPressed: () {
                                      Navigator.of(context).pop();
                                    },
                                    child: Text('取消')),
                              ),
                            ),
                          ],
                        ),
        //              Container(
        //                margin: EdgeInsets.all(10),
        //                decoration: BoxDecoration(
        //                    color: Color.fromARGB(180, 240, 240, 240),
        //                    borderRadius: BorderRadius.all(Radius.circular(3))),
        //                child: Row(
        //                  children: [
        //                    Expanded(
        //                        child: Container(
        //                            padding: EdgeInsets.symmetric(horizontal: 10),
        //                            child: TextField(
        //                              controller: searchOfCategoryCon,
        //                              style:
        //                                  TextStyle(fontSize: 16, color: Colors.black),
        //                              maxLines: 1,
        ////                                    keyboardType: TextInputType.text,
        //                              decoration: InputDecoration(
        //                                hintText: '搜索类别',
        //                                counterText: '',
        //                                disabledBorder: InputBorder.none,
        //                                enabledBorder: InputBorder.none,
        //                                focusedBorder: InputBorder.none,
        //                              ),
        //                            ))),
        //                    ElevatedButton(onPressed: () {}, child: Text('搜索')),
        //                  ],
        //                ),
        //              ),
        //              Container(
        //                margin: EdgeInsets.symmetric(horizontal: 10),
        //                child: ElevatedButton(
        //                    onPressed: () {},
        //                    child: Container(
        //                        child: Row(
        //                      mainAxisAlignment: MainAxisAlignment.center,
        //                      children: [
        //                        Text('添加新类别'),
        //                      ],
        //                    ))),
        //              ),
                        Container(
                          height: MediaQuery.of(context).size.height * 0.6,
                          child: ListView.separated(
                            itemCount: cateList.length,
                            itemBuilder: (context, index) => ListTile(
                              title: Text(cateList[index].fCategoryName),
                              onTap: (){
                                setState(() {
                                  categoryCon.text=cateList[index].fCategoryName;
                                  subCategoryID=cateList[index].specificationsID;
                                  specificationsID=null;
                                  specificationCon.text='';
                                  modelID=null;
                                  modelCon.text='';
                                  Navigator.pop(context);
                                });
                              },
                            ),
                            separatorBuilder: (context, index) => Divider(),
                          ),
                        )
                      ],
                    );
                  });
      } else {
        showToast('暂未配置类别，请在电脑端配置');
      }
    });

  }

  ///选择规格
  void showPopOfSpecification() {
    List<ProdSpecificationsEntity> specificationsList=[];
    if(subCategoryID==null){
      showToast('请先选择类别');
      return;
    }
    RequestUtil.post(Api.getProdSpecifications, {'subCategoryID':subCategoryID}).then((value) {
      List tempList=value['Data'];
      tempList.forEach((element) {
        specificationsList.add(prodSpecificationsEntityFromJson(ProdSpecificationsEntity(), element));
      });
      if (specificationsList.length>0) {
        showModalBottomSheet(
            context: context,
            isScrollControlled: true,
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(10), topRight: Radius.circular(10))),
            builder: (context) {
              return Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  Stack(
                    children: [
                      Align(
                        alignment: Alignment.center,
                        child: Padding(
                          padding: const EdgeInsets.symmetric(vertical: 14),
                          child: Text(
                            '产品规格',
                            style: TextStyle(fontSize: 18),
                          ),
                        ),
                      ),
                      Align(
                        alignment: Alignment.topRight,
                        child: Container(
                          margin: EdgeInsets.only(right: 10),
                          child: TextButton(
                              onPressed: () {
                                Navigator.of(context).pop();
                              },
                              child: Text('取消')),
                        ),
                      ),
                    ],
                  ),
//              Container(
//                margin: EdgeInsets.all(10),
//                decoration: BoxDecoration(
//                    color: Color.fromARGB(180, 240, 240, 240),
//                    borderRadius: BorderRadius.all(Radius.circular(3))),
//                child: Row(
//                  children: [
//                    Expanded(
//                        child: Container(
//                            padding: EdgeInsets.symmetric(horizontal: 10),
//                            child: TextField(
//                              controller: searchOfSpecificationsCon,
//                              style:
//                                  TextStyle(fontSize: 16, color: Colors.black),
//                              maxLines: 1,
////                                    keyboardType: TextInputType.text,
//                              decoration: InputDecoration(
//                                hintText: '搜索规格',
//                                counterText: '',
//                                disabledBorder: InputBorder.none,
//                                enabledBorder: InputBorder.none,
//                                focusedBorder: InputBorder.none,
//                              ),
//                            ))),
//                    ElevatedButton(onPressed: () {}, child: Text('搜索')),
//                  ],
//                ),
//              ),
//              Container(
//                margin: EdgeInsets.symmetric(horizontal: 10),
//                child: ElevatedButton(
//                    onPressed: () {},
//                    child: Container(
//                        child: Row(
//                      mainAxisAlignment: MainAxisAlignment.center,
//                      children: [
//                        Text('添加规格'),
//                      ],
//                    ))),
//              ),
                  Container(
                    height: MediaQuery.of(context).size.height * 0.6,
                    child: ListView.separated(
                      itemCount: specificationsList.length,
                      itemBuilder: (context, index) => ListTile(
                        title: Text(specificationsList[index].fCategoryName),
                        onTap: (){
                          setState(() {
                            specificationCon.text=specificationsList[index].fCategoryName;
                            specificationsID=specificationsList[index].specificationsID;
                            modelID=null;
                            modelCon.text='';
                            Navigator.pop(context);
                          });
                        },
                      ),
                      separatorBuilder: (context, index) => Divider(),
                    ),
                  )
                ],
              );
            });
      } else {
        showToast('暂未配置规格，请在电脑端配置');
      }
    });

  }

  ///选择品牌
  void showPopOfBrand() {
    List<FactoryBrandEntity> brandList=[];
    RequestUtil.post(Api.getFactoryBrand, {}).then((value) {
      List tempList=value['Data'];
      tempList.forEach((element) {
        brandList.add(factoryBrandEntityFromJson(FactoryBrandEntity(), element));
      });
      if (brandList.length>0) {
        showModalBottomSheet(
            context: context,
            isScrollControlled: true,
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(10), topRight: Radius.circular(10))),
            builder: (context) {
              return Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  Stack(
                    children: [
                      Align(
                        alignment: Alignment.center,
                        child: Padding(
                          padding: const EdgeInsets.symmetric(vertical: 14),
                          child: Text(
                            '产品品牌',
                            style: TextStyle(fontSize: 18),
                          ),
                        ),
                      ),
                      Align(
                        alignment: Alignment.topRight,
                        child: Container(
                          margin: EdgeInsets.only(right: 10),
                          child: TextButton(
                              onPressed: () {
                                Navigator.of(context).pop();
                              },
                              child: Text('取消')),
                        ),
                      ),
                    ],
                  ),
//              Container(
//                margin: EdgeInsets.all(10),
//                decoration: BoxDecoration(
//                    color: Color.fromARGB(180, 240, 240, 240),
//                    borderRadius: BorderRadius.all(Radius.circular(3))),
//                child: Row(
//                  children: [
//                    Expanded(
//                        child: Container(
//                            padding: EdgeInsets.symmetric(horizontal: 10),
//                            child: TextField(
//                              controller: searchOfBrandCon,
//                              style:
//                                  TextStyle(fontSize: 16, color: Colors.black),
//                              maxLines: 1,
////                                    keyboardType: TextInputType.text,
//                              decoration: InputDecoration(
//                                hintText: '搜索品牌',
//                                counterText: '',
//                                disabledBorder: InputBorder.none,
//                                enabledBorder: InputBorder.none,
//                                focusedBorder: InputBorder.none,
//                              ),
//                            ))),
//                    ElevatedButton(onPressed: () {}, child: Text('搜索')),
//                  ],
//                ),
//              ),
//              Container(
//                margin: EdgeInsets.symmetric(horizontal: 10),
//                child: ElevatedButton(
//                    onPressed: () {
//                      showToast('待开发...');
//                    },
//                    child: Container(
//                        padding: EdgeInsets.symmetric(vertical: 15),
//                        child: Row(
//                      mainAxisAlignment: MainAxisAlignment.center,
//                      children: [
//                        Text('添加新品牌'),
//                      ],
//                    ))),
//              ),
                  Container(
                    height: MediaQuery.of(context).size.height * 0.6,
                    child: ListView.separated(
                      itemCount: brandList.length,
                      itemBuilder: (context, index) => ListTile(
                          title: Text(brandList[index].fBrandName),
                          onTap: (){
                            setState(() {
                              brandCon.text=brandList[index].fBrandName;
                              brandID=brandList[index].fBrandID;
                              Navigator.pop(context);
                            });
                          }
                      ),
                      separatorBuilder: (context, index) => Divider(),
                    ),
                  )
                ],
              );
            });
      } else {
        showToast('暂未配置品牌，请在电脑端配置');
      }
    });

  }

  ///选择工厂地址
  void showPopOfAddr() {
    List<FactoryAddressEntity> addrList=[];
    RequestUtil.post(Api.getFactoryAddress, {}).then((value) {
      List tempList=value['Data'];
      tempList.forEach((element) {
        addrList.add(factoryAddressEntityFromJson(FactoryAddressEntity(), element));
      });
      if (addrList.length>0) {
        showModalBottomSheet(
            context: context,
            isScrollControlled: true,
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(10), topRight: Radius.circular(10))),
            builder: (context) {
              return Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  Stack(
                    children: [
                      Align(
                        alignment: Alignment.center,
                        child: Padding(
                          padding: const EdgeInsets.symmetric(vertical: 14),
                          child: Text(
                            '收件地址',
                            style: TextStyle(fontSize: 18),
                          ),
                        ),
                      ),
                      Align(
                        alignment: Alignment.topRight,
                        child: Container(
                          margin: EdgeInsets.only(right: 10),
                          child: TextButton(
                              onPressed: () {
                                Navigator.of(context).pop();
                              },
                              child: Text('取消')),
                        ),
                      ),
                    ],
                  ),
//              Container(
//                margin: EdgeInsets.symmetric(horizontal: 10),
//                child: ElevatedButton(
//                    onPressed: () {
//                      showToast('待开发...');
//                    },
//                    child: Container(
//                        padding: EdgeInsets.symmetric(vertical: 15),
//                        child: Row(
//                          mainAxisAlignment: MainAxisAlignment.center,
//                          children: [
//                            Text('添加新地址'),
//                          ],
//                        ))),
//              ),
                  Container(
                    height: MediaQuery.of(context).size.height * 0.6,
                    child: ListView.separated(
                      itemCount: addrList.length,
                      itemBuilder: (context, index) => ListTile(
                          title: Text(addrList[index].name),
                          onTap: (){
                            setState(() {
                              addrStr=addrList[index].name;
                              addrID=addrList[index].value;
                              Navigator.pop(context);
                            });
                          }
                      ),
                      separatorBuilder: (context, index) => Divider(),
                    ),
                  )
                ],
              );
            });
      } else {
        showToast('暂未配置收货地址，请在电脑端配置');
      }
    });

  }
}

class FactoryProdEntityIsSelected{
  FactoryProdEntity prod;
  bool isSelected;//是否选中

  FactoryProdEntityIsSelected(this.prod, {this.isSelected=false});

}
class PartEntityIsSelected{
  PartEntity part;
  bool isSelected;//是否选中

  PartEntityIsSelected(this.part, {this.isSelected=false});

}